/*手机产品技术规格部分逻辑代码
------------------------------------------------------*/

/*副导航滚动时固定
---------------------------------------------------------------------------*/
var oNavSecondWrapper = document.querySelector(".nav-second-wrapper");

myAddEvent(window, 'scroll', function () {
    if (getScrollOffset().y > 60) {
        oNavSecondWrapper.style.position = "fixed";
    } else {
        oNavSecondWrapper.style.position = "static";
    }
})


/*栏目一点击按钮切换内容
--------------------------------------------------------------------------*/
var aBtnGroup = document.querySelectorAll(".content01-btn-group a");
var aContent01Desc = document.querySelectorAll(".content01 .desc");

for (var i = 0;i < aBtnGroup.length;i++) {
    aBtnGroup[i].index = i;
    aBtnGroup[i].onclick = function (params) {
        // console.log(this.index);

        for (var i = 0;i < aBtnGroup.length;i++) {
            aBtnGroup[i].style.backgroundPositionY = "-4px";
            aBtnGroup[i].style.height = "53px";
            aBtnGroup[i].style.marginBottom = "34px";
        }

        this.style.backgroundPositionY = "-61px";
        this.style.height = "87px";
        this.style.marginBottom = "0";

        for (var j = 0;j < aContent01Desc.length;j++) {
            // console.log('aaa');
            aContent01Desc[j].style.opacity = "0";
            
            aContent01Desc[this.index].style.opacity = "1";
        }
    }
}


/*左侧垂直导航
---------------------------------------------------------------------------*/
var sideBarLi = document.querySelectorAll(".side-bar li");
var sideBarUl = document.querySelector(".side-bar");

myAddEvent(window, 'scroll', function () {
    console.log(window.pageYOffset);
    var curScr = getScrollOffset().y;
    if (curScr >= 0 && curScr < 626){

        sideBarStyleDel();
        sideBarLi[0].className = "active";
    } else if (curScr >= 626 && curScr < 1134) {

        sideBarStyleDel();
        sideBarLi[1].className = "active";
    } else if (curScr >= 1134 && curScr < 1660) {

        sideBarStyleDel();
        sideBarLi[2].className = "active";
    } else if (curScr >= 1660 && curScr < 2177) {

        sideBarStyleDel();
        sideBarLi[3].className = "active";
    } else if (curScr >= 2177 && curScr < 2694) {

        sideBarStyleDel();
        sideBarLi[4].className = "active";
    } else if (curScr >= 2694 && curScr < 3211) {

        sideBarStyleDel();
        sideBarLi[5].className = "active";
    } else if (curScr >= 3211 && curScr < 3419) {

        sideBarStyleDel();
        sideBarLi[6].className = "active";
    } else if (curScr >= 3419 && curScr < 3729) {

        sideBarStyleDel();
        sideBarLi[7].className = "active";
    } else if (curScr >= 3729 && curScr < 4246) {

        sideBarStyleDel();
        sideBarLi[8].className = "active";
    } else if (curScr >= 4246 && curScr < 4846) {

        sideBarStyleDel();
        sideBarLi[9].className = "active";
    } else if (curScr >= 4846 && curScr < 5154) {

        sideBarStyleDel();
        sideBarLi[10].className = "active";
    } else if (curScr >= 5154) {

        sideBarStyleDel();
        sideBarLi[11].className = "active";
    }

    if (curScr >= 0 && curScr < 5000) {

        sideBarUl.style.position = "fixed";
        sideBarUl.style.top = "60px";
    } else {
        sideBarUl.style.position = 'absolute';
        sideBarUl.style.top = "5000px";
    }
});

function sideBarStyleDel () {
    for (var i = 0;i < sideBarLi.length;i++) {
        sideBarLi[i].className = "";
    }
}



